﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Threading;
using System.Globalization;
using System.Resources;

using EHTWebsite.Code;

namespace EHTWebsiteProject
{
    public partial class TuyenDungDetail : System.Web.UI.Page
    {
        public Boolean IsVN = true;
        private String languageCode = "vi-VN";
        private ResourceManager rm = new ResourceManager("Resources.SiteMap", System.Reflection.Assembly.Load("App_GlobalResources"));

        private Int32 TuyenDungID = -1;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                languageCode = Session[HangSo.LANGUAGE_CODE].ToString();

                if (languageCode == "en-us")
                {
                    IsVN = false;
                }
            }
            catch (Exception ex)
            {
            }

            try
            {
                TuyenDungID = Int32.Parse(Request.QueryString["TuyenDungID"].ToString());

                if (languageCode == "en-us")
                {
                    IsVN = false;
                }
            }
            catch (Exception ex)
            {
            }

            if (!Page.IsPostBack)
            {
                EHTWebsite.Code.TinTuc theTinTuc = TinTucProvider.GetTinTucByTinTucID(TuyenDungID);

                if (theTinTuc != null)
                {
                    if (IsVN == true)
                    {
                        this.ltrTuyenDungTitle.Text = theTinTuc.TieuDeVN;
                        this.ltrTuyenDungNoiDung.Text = theTinTuc.NoiDungVN;
                    }
                    else
                    {
                        this.ltrTuyenDungTitle.Text = theTinTuc.TieuDeOther;
                        this.ltrTuyenDungNoiDung.Text = theTinTuc.NoiDungOther;
                    }
                }

                Thread.CurrentThread.CurrentCulture = new CultureInfo(languageCode);
                LoadLanguage(Thread.CurrentThread.CurrentCulture);
            }
        }
        public void LoadLanguage(CultureInfo ci)
        {
            this.ltrTuyenDung_Title.Text = rm.GetString("ltrTuyenDung_Title", ci);
        }
    }
}
